%{
create by rainsoftly
Date:2020/12/6
brief:the main of the project, display the signal
%}

clc;
clear;
% init sound card I/O
samplePerFrame = 1024; % frame buffer
sampleRate = 44100; % franquence to sample sound
deviceReader = audioDeviceReader(...
    'SamplePerFrame', samplePerFrame, ...
    'SampleRate', sampleRate); % init I/O

% init scope
timeSpan = 3;
bufferLength = 44100 * 10.5;
scope = dsp.TimeScope('SampleRate', sampleRate, ...
    'TimeSpan', timeSpan, 'BufferLength', bufferLength, ...
    'TimeSpanOverrunAction', 'scroll', 'YLimits', [-1, 1]);

% print('start to display sound signal...')
tic

while toc < 10
    radioFromDevice = deviceReader();
    scope(radioFromDevice);
end

release(deviceReader);
release(scope);
% print('end display')
